#ifndef SYMBOLTABLEDLG_H
#define SYMBOLTABLEDLG_H

#include <QtGUI>

QT_BEGIN_NAMESPACE
class QTableWidget;
class QTableWidgetItem;
QT_END_NAMESPACE

class SymbolTableDlg : public QDialog
{
Q_OBJECT
public:
    explicit SymbolTableDlg(QWidget *parent = 0);
    void CreateSymbolTable();
    void ClearSymbolTable();

    inline void LoadSymbolTable(QString &s, quint32 v)
    {
        QTableWidgetItem *fileNameItem = new QTableWidgetItem(s);
        fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
        QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("0x%1").arg(v, 8, 16));
        sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
        sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);

        int row = SymbolTable->rowCount();
        SymbolTable->insertRow(row);
        SymbolTable->setItem(row, 0, fileNameItem);
        SymbolTable->setItem(row, 1, sizeItem);
    }

signals:
    void SendSymName(QString);

public slots:
    void GetSymName(int, int);

private:
    QTableWidget *SymbolTable;
};

#endif // SYMBOLTABLEDLG_H
